<template>
  <div>
    <!-- <div v-show="flag">我是一张图片</div> -->
    <div v-if="flag">我是一张图片</div>
    <button @click="fn">点击以后显示和隐藏</button>
  </div>
</template>

<script>
export default {
  //该vue组件的数据源
  data() {
    return {
      flag: false,
    }
  },
  methods: {
    fn() {
      this.flag = !this.flag
    },
  },
}
</script>

<style scoped></style>
